﻿@*
    For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@
@{
}


<link href="~/lib/layui/css/layui.css" rel="stylesheet" />
<script src="~/lib/layui/layui.js"></script>
<script src="~/lib/jquery/dist/jquery.js"></script>

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>报工列表</title>
    <link href="//unpkg.com/layui@2.9.18/dist/css/layui.css" rel="stylesheet">
</head>
<body>
    <form class="layui-form" margin-top: 20px;>
        <div class="layui-form-item">
            <div class="layui-input-inline">
               <input type="text" name="name" id="name" placeholder="工单编号" autocomplete="off" class="layui-input">
            </div>
            <button type="button" class="layui-btn layui-bg-blue">查询</button>
            <button type="button" class="layui-btn layui-bg-blue">高级查询</button>
            <button type="button" class="layui-btn layui-bg-green">导出</button>
            <button type="button" class="layui-btn layui-bg-orange" onclick="Steat()">审批通过</button>
            <button type="button" class="layui-btn layui-bg-orange">审批不通过</button>
        </div>
    </form>
    <dvi>
        <table class="layui-table">
            <thead>
                <tr>
                    <th>工单</th>
                    <th>工单编号</th>
                    <th>工序名称</th>
                    <th>工序编号</th>
                    <th>审批状态</th>
                    <th>审批人</th>
                    <th>审批时间</th>
                    <th>创建时间</th>
                    <th>创建人</th>
                    <th>修改人</th>
                    <th>修改时间</th>
                </tr>
            </thead>
            <tbody>
                
            </tbody>
        </table>
    </dvi>


    <script src="//unpkg.com/layui@2.9.18/dist/layui.js"></script>
    <script src="//unpkg.com/jquery/dist/jquery.js"></script>
    <script>

        $(function () {
            getOrder()
        })

        function getOrder(){
            $.post({
                url: "http://localhost:5196/api/GoldIngot/Handle/CompletionOrderSelect",
                data: JSON.stringify({}), // 使用 JSON 格式
                async: false,
                dataType: "json",
                contentType: "application/json",
                success: res => {
                    console.log(res)
                    var context = "";
                    $.each(res.data, function () {
                        context += `<tr>
                                    <td>${this.workSheetId}</td>
                                    <td>${this.workSheetNumber}</td>
                                    <td>${this.processName}</td>
                                    <td>${this.processNumber}</td>
                                    <td>${this.completionOrderStatus?"审核未通过":"审核通过"}</td>
                                    <td>${this.createName}</td>
                                    <td>${this.completionOrderDate}</td>
                                    <td>${this.createDate}</td>
                                    <td>${this.createName}</td>
                                    <td>${this.updateName}</td>
                                    <td>${this.updateDate}</td>
                        </tr>`
                    })
                            $("tbody").html(context);
                }
            })
        }


        function Steat() {
            $.post({
                url: "http://localhost:5196/api/GoldIngot/Handle/CompletionOrderUpdate",
                data: JSON.stringify({ completionOrderStatus :1}), // 使用 JSON 格式
                async: false,
                dataType: "json",
                contentType: "application/json",
                success: res => {
                    console.log(res)
                }
            })
        }

    </script>


</body>
</html>